/**
 * 微信开放平台登录
 * @param doc document
 * @param option 选项
 */
const wxLogin = (doc,option)=>{
    let c = "default";
    option.self_redirect === !0 ? c = "true" : option.self_redirect === !1 && (c = "false");
    let iframe = doc.createElement("iframe");
    let e = "https://open.weixin.qq.com/connect/qrconnect?appid=" + option.appid
            + "&scope=" + option.scope + "&redirect_uri=" + option.redirect_uri + "&state=" + option.state
            + "&login_type=jssdk&self_redirect=" + c + '&styletype=' + (option.styletype || '')
            + '&sizetype=' + (option.sizetype || '') + '&bgcolor=' + (option.bgcolor || '')
            + '&rst=' + (option.rst || '');
    e += option.style ? "&style=" + option.style : "";
    e += option.href ? "&href=" + option.href : "";
    iframe.src = e;
    iframe.frameBorder = "0";
    iframe.allowTransparency = "true";
    iframe.scrolling = "no";
    iframe.width = "300px";
    iframe.height = "400px";
    let f = doc.getElementById(option.id);
    f.innerHTML = "";
    f.appendChild(iframe);
}
export default wxLogin;
